<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="inpValue">
        <button @click="append">append</button>
        <ul>
            <li v-for="item in arr">{{item}}</li>
        </ul>
        <ul class="page">
            <li 
                v-for="item in Math.ceil(arr.length / 5)"
                @click="changePageIndex(item)"
                :class="{'active':item === pageIndex}"    >
                {{item}}
            </li>
        </ul>
    </div>

    <script src="js/vue.js"></script>
    <script>
        //数据驱动
        let myApp = new Vue({
            el:'#app',
            data:{
                inpValue:'',
                arr:[],
                pageIndex:0
            },
            methods:{
                append(){
                    this.arr.push(this.inpValue)
                    this.inpValue = ''
                },
                changePageIndex(pageIndex){
                    console.log(pageIndex)
                    this.pageIndex = pageIndex
                }
            }
        })
    </script>
</body>
</html>